﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using InventorySys.controller;
using Model.Upadan;
using Model.Sadharon;

namespace InventorySys.view
{
    public partial class StockInfo : Form
    {
        private Product product;
        private ProductController productControl;
        private List<Product> allProducts; 
        
        public StockInfo()
        {
            InitializeComponent();
            product = new Product();
            productControl = new ProductController();
            PopulateProducts();
        }

        private void DtGrdStockInfo_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void PopulateProducts(){
            allProducts = (List<Product>)productControl.GetAllProducts().ResultObj;
            int _index = 0;
            foreach(Product _product in allProducts) {
            DtGrdStockInfo.Rows.Add();
            DtGrdStockInfo.Rows[_index].Cells[0].Value = _product.Code;
            DtGrdStockInfo.Rows[_index].Cells[1].Value = _product.ProductName;
            DtGrdStockInfo.Rows[_index].Cells[2].Value = _product.Description;
            DtGrdStockInfo.Rows[_index].Cells[3].Value = _product.IsVat;
            DtGrdStockInfo.Rows[_index].Cells[4].Value = _product.Price;
            DtGrdStockInfo.Rows[_index].Cells[5].Value = _product.Delcharge;
            DtGrdStockInfo.Rows[_index].Cells[6].Value = _product.Quantity;
            DtGrdStockInfo.Rows[_index].Cells[7].Value = _product.Colour;
            DtGrdStockInfo.Rows[_index].Cells[8].Value = _product.Size;
            _index++;
            }
        
        }
    }
}
